$(document).ready(function (e) {
    /*****************************************************right-menu*************************************************/
    $('.rightMenu-li').hover(function() {
            $(this).addClass('slider-left-hover')
        },
        function() {
            $(this).removeClass('slider-left-hover')
        });
    /*$('.rightMenu-ad').hover(function() {
     $(this).find('.rightMenu-adImg').show()
     },
     function() {
     $(this).find('.rightMenu-adImg').hide()
     });
     var count = 0;
     $('.right-cart').click(function (e) {
     count ++ ;
     if(count%2==0){
     $(this).closest('.rightMenu').animate({right: '-365px'});
     } else {
     $(this).closest('.rightMenu').animate({right:'0px'});
     }
     })
     $('.right-cart').hover(function(){
     $(this).find('.cart-num').css({'background':'#fff','color':'#c40000'});
     },function(){
     $(this).find('.cart-num').css({'background':'#c40000','color':'#fff'});
     })
     $('.cart-cell').hover(function(){
     $(this).find('.icon-cart-add,.icon-cart-jian,.icon-cart-del').css('display','-webkit-inline-box');
     },function(){
     $(this).find('.icon-cart-add,.icon-cart-jian,.icon-cart-del').css('display','none');
     });
     $('.icon-cart-del').click(function(){
     //$(this).fadeOut(1000,function() {
     $(this).closest('.cart-cell').remove().fadeOut();
     //});
     })*/
    /*****************************************************login******************************************************************/
    $('#login-popup').on('click', function () {
        $.layer({
            type: 1,
            title: 'isale账户登录',
            shadeClose: false,
            offset: ['240px', ''],
            border: [0],
            area: ['400px', '410px'],
            fadeIn: 1000,
            fadeOut: 1000,
            shade: [0.6, '#000'],
            fix: true,
            page: {dom: '#index-login'}
        });
    });
    /*****************************************************input border*************************************************/
    $('.input').mouseover(function (e) {
        $(this).addClass('border-hover').siblings().removeClass('border-hover');
    }),
        $('.input').mouseout(function (e) {
            $(this).removeClass('border-hover');
        });
    /***********************************loading***********************************************************/
    $('.loading').lazyload({
        placeholder:"images/loading.gif",
        effect: "fadeIn"
    });
});
// fixedMenu
$(function(){

    var fixedMenuH = $('.fixedMenu').offset().top;
    //获取定位元素距离浏览器顶部的距离
    $(window).scroll(function(){
        //滚动事件
        var scroH = $(this).scrollTop();
        //获取滚动条的滑动距离
        if(scroH>fixedMenuH){
            $('.fixedMenu').css({'position':'fixed','top':0,'filter':(opacity=97),'opacity':0.97});
        }else if(scroH<fixedMenuH){
            $('.fixedMenu').css({'position':'static','filter':(opacity=10),'opacity':10});


        };
    });
});

////goodsList
    $('.quickMenu>ul>li').hover(function(){
        $(this).find('a').css('margin-left','10px').animate({left:'10px'});
    },function(){
        $(this).find('a').css('margin-left','10px').animate({left:'0px'});
    });
/***********************************console***********************************************************/
    console.log("欢迎访问本站！");
    console.log("如有合作请发送邮件至%c isale2014@qq.com", "color:#63b38e");
    console.log("站长介绍：http://isale.cc");

/*****************************************************placeholder*************************************************/
if (!('placeholder' in document.createElement('input'))) {
    $('input[placeholder],textarea[placeholder]').each(function () {
        var that = $(this),
            text = that.attr('placeholder');
        if (that.val() === "") {
            that.val(text).addClass('placeholder');
        }
        that.focus(function () {
                if (that.val() === text) {
                    that.val("").removeClass('placeholder');
                }
            })
            .blur(function () {
                if (that.val() === "") {
                    that.val(text).addClass('placeholder');
                }
            })
            .closest('form').submit(function () {
            if (that.val() === text) {
                that.val('');
            }
        });
    });
}
/*! Lazy Load 1.9.3 - MIT license - Copyright 2010-2013 Mika Tuupola */
!function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null,placeholder:""};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("<img />").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document);
